package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 主场搭建商图纸分类审核记录
 * </p>
 *
 * @author dqq
 * @date 2023-04-28
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "HomeBuilderDrawingCategoryAuditDrawingSourceEnum", description = "图纸来源 #{BUILDER_REPORT:搭建商报馆;HOME_REPORT:主场一键报馆-枚举")
public enum HomeBuilderDrawingCategoryAuditDrawingSourceEnum implements BaseEnum {

    /**
     * BUILDER_REPORT="搭建商报馆"
     */
    BUILDER_REPORT("搭建商报馆"),
    /**
     * HOME_REPORT="主场一键报馆"
     */
    HOME_REPORT("主场一键报馆"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static HomeBuilderDrawingCategoryAuditDrawingSourceEnum match(String val, HomeBuilderDrawingCategoryAuditDrawingSourceEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static HomeBuilderDrawingCategoryAuditDrawingSourceEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(HomeBuilderDrawingCategoryAuditDrawingSourceEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "BUILDER_REPORT,HOME_REPORT", example = "BUILDER_REPORT")
    public String getCode() {
        return this.name();
    }

}
